//
//  SYS_HomeVC.m
//  System_App
//
//  Created by czy001 on 2017/11/27.
//  Copyright © 2017年 czy001. All rights reserved.
//

#import "SYS_HomeVC.h"


@interface SYS_HomeVC ()<UIWebViewDelegate>
@property (nonatomic,strong) UIWebView *webView;


@end

@implementation SYS_HomeVC


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor=DGHColor(242, 242, 242);
    [self initWithUI];
    
}

//view即将出现时改变导航栏的背景图片
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden=YES;

}

#pragma mark  ---------initWithUI-----
-(void) initWithUI
{
    _webView=[[UIWebView alloc]init];
    if ([UIDevice currentDevice].systemVersion.floatValue>=11) {
        _webView.frame=CGRectMake(0, -StatusBarHeight, SCREENWIDTH, SCREENHEIGHT-TabBarHeight+StatusBarHeight);
    }else{
        _webView.frame=CGRectMake(0, -StatusBarHeight, SCREENWIDTH, SCREENHEIGHT-TabBarHeight+StatusBarHeight);
    }
    _webView.scrollView.showsHorizontalScrollIndicator=NO;
    _webView.scrollView.showsVerticalScrollIndicator=NO;
    _webView.delegate=self;
    _webView.dataDetectorTypes = UIDataDetectorTypeNone;
    _webView.backgroundColor=DGHColor(242,242 , 242);
    [self.view addSubview:_webView];
    //    NSString *session=[SYS_LoginModel instance].sessionInfo.session;
    //    UICKeyChainStore *keychainStore = [UICKeyChainStore keyChainStore];
    //    NSString *pid = [keychainStore stringForKey:@"pid"];
    //    NSURL *url = [NSURL URLWithString:FORMAT(@"http://118.178.188.69:8081/index.html#/store/?session=%@&pid=%@", session,pid)];
    NSURL *url = [NSURL URLWithString:FORMAT(@"http://118.178.188.69:8081/index.html#/home/")];
    NSString *body=nil;
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:url];
    [request setHTTPMethod: @"GET"];
    [request setHTTPBody: [body dataUsingEncoding:NSUTF8StringEncoding]];
    [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
    [_webView loadRequest: request];
    
}


#pragma mark ------UIWebViewDelegate---------
- (void)webViewDidStartLoad:(UIWebView *)webView {
    
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    
    
    
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    
}





@end
